'''
Cookie的常用方法：
(1)get_cookies()		获取所有的cookie信息
(2)add_cookie(cookie_dict)				添加cookie。cookie_dict指字典对象，必须有name和value值
'''
from selenium import webdriver
from time import sleep
chrome_location = r'D:\chrom browser\chrome-win\chrome.exe'
options = webdriver.ChromeOptions()
options.binary_location = chrome_location
dr = webdriver.Chrome(options=options)
dr.get(r'https://www.baidu.com/')
dr.maximize_window()
sleep(3)
cookies={'name':'test01','value':'123'}
dr.add_cookie(cookies)   #添加cookies

for cookie in dr.get_cookies():   #获取cookie
    print(f'{cookie["name"]}--------{cookie["value"]}')
sleep(3)

dr.quit()

